package com.teamwork.ZuccEcho.Service.impl;

import com.teamwork.ZuccEcho.Entity.Student;
import com.teamwork.ZuccEcho.Entity.Teacher;
import com.teamwork.ZuccEcho.Repository.LoginTeaApiRepository;
import com.teamwork.ZuccEcho.Service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    private LoginTeaApiRepository loginTeaApiRepository;

    @Override
    public List<Teacher> getTeacherList() {
        return loginTeaApiRepository.findAll();
    }


    public boolean login(String s_id,String password){
        List<Teacher> teachers = loginTeaApiRepository.findAll();
        for (Teacher t:
                teachers) {
            if(t.getTch_id().equals(s_id) && t.getTch_pwd().equals(password)){
                return true;
            }
        }
        return false;
    }

}
